/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author Achie
 */
@Entity
@Table(name = "Note")
public class Note implements Serializable {

    @Id
    @GeneratedValue
    @Column(name = "id")
    private long id;
    @Column(name = "text")
    private String text;
    @ManyToOne
    private Lesson lesson;
    @ManyToOne
    private User user;
    @Column(name = "added_on")
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date date;

    public Note() {
    }

    public Note(long id, String text, Lesson lesson, User user) {
        this.setId(id);
        this.setText(text);
        this.setLesson(lesson);
        this.setUser(user);
        this.setText(text);
        this.setDate();
    }

    /**
     * @return the id
     */
    public long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * @return the text
     */
    public String getText() {
        return text;
    }

    /**
     * @param text the text to set
     */
    public void setText(String text) {
        this.text = text;
    }

    /**
     * @return the lesson
     */
    public Lesson getLesson() {
        return lesson;
    }

    /**
     * @param lesson the lesson to set
     */
    public void setLesson(Lesson lesson) {
        this.lesson = lesson;
    }

    /**
     * @return the student
     */
    public User getUser() {
        return user;
    }

    /**
     * @param student the student to set
     */
    public void setUser(User user) {
        this.user = user;
    }

    /**
     * @return the date
     */
    public Date getDate() {
        return date;
    }

    /**
     * @param date the date to set
     */
    public void setDate() {
        Date date = new Date();
        this.date = date;
    }
}
